﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml;

namespace com.IronOne.BoardPACWinApp.Extensions
{
    /// <summary>
    /// 
    ///  <title>Multi Select ListView</title>
    ///  <description>Custom ListView for select multiple items in mvvm</description>
    ///  <copyRight>Copyright (c) 2015</copyRight>
    ///  <company>IronOne Technologies (Pvt) Ltd</company>
    ///  <createdOn>2015-04-02</createdOn>
    ///  <author>Bhathiya Dasanayake</author>
    ///  <modification>
    ///     <modifiedBy></modifiedBy>
    ///      <modifiedDate></modifiedDate>
    ///     <description></description>
    ///  </modification>
    ///
    /// </summary>
    public class MultiSelectListView : ListView //Used in AddCommentsViewModel
    {
        protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
        {
            base.PrepareContainerForItemOverride(element, item);
            ListViewItem listItem = element as ListViewItem;
            Binding binding = new Binding();
            binding.Mode = BindingMode.TwoWay;
            binding.Source = item;
            binding.Path = new PropertyPath("IsMemberSelected");
            listItem.SetBinding(ListViewItem.IsSelectedProperty, binding);
        }
    }
}
